package Review2;

import java.util.Stack;

public class Test22 {
   public boolean isPopOrder(int[] push,int[] pop){
	   Stack<Integer> stack = new Stack<Integer>();
	   int j=0;
	   for(int i=0;i<push.length;i++){
		   stack.push(push[i]);
		   while(j<pop.length&&stack.peek()==pop[j]){
			   stack.pop();
			   j++;
		   }
	   }
	   return stack.isEmpty();
   }
}
